How to download Torrents using the command-line in Terminal

rTorrent lets you download Torrents from the Terminal using command-lines. Being a Command-Line Interface program (CLI), it is light-weight and quick.

Using torrents is a great and efficient way of file sharing. It provides useful features like the ability to pause downloads, setting upload/download speed limits, and managing multiple downloads efficiently. And since downloading a torrent is based on the availability of its seeders, it’s more common in an interactive community, like that of FOSS.

Table des matières

How to download Torrents using the command-line in Terminal

Download Torrents using Command-line

rTorrent Features

1. Terminal is the UI

2. Minimum CPU and maximum bandwidth

3. Torrent information

Installation

Usage

Starting up rTorrent

Adding torrents

Magnet links

Changing the destination directory

Starting download

Stopping and removing the torrent download

Viewing more information

Changing priorities

Viewing options

Exiting

Configuration file

Conclusion

 

Download Torrents using Command-line

In this article of Terminal Tuts, we’re going to show you how to download Torrents using the command-line via the Terminal interface. We will use a program called rTorrent. There are many others, but most of them were created because of the existence of their GUI first. rTorrent is independent and only CLI based.

rTorrent Features

1. Terminal is the UI

Being a CLI program, we would expect the content to be organized well, and rTorrent exactly does that. Categorization of items is clear, and that’s all one need to use the program.

rtorrent UIrtorrent UI 
 

2. Minimum CPU and maximum bandwidth

rTorrent is light on the system resources as it is a text-based program. It fetches the maximum data transfer speeds! Therefore, when compared to a GUI based torrent program, you will undoubtedly notice a considerable increase in system performance and data speeds.

3. Torrent information

Users can view the details of the torrents opened in rTorrent similar to any GUI torrent client. Information such as the size of the files, the amount downloaded, the upload/download speed, remaining time and a few more details are displayed.

Torrent infoTorrent info 
 

Further, users can check information like source, filename, size, active time, number of files, memory usage and even details like the number of chunks.

Options are available to view the peer list, file list, tracker list, transfer list and the chunks seen.

These can be accessed by simply selecting a torrent and pressing the Right Arrow key.

Torrent detailsTorrent details 
 

Installation

rTorrent is available in most major distributions’ repositories. For Ubuntu, Linux Mint or any derivatives, type:

sudo apt-get install rtorrent

 rT installrT install
 

For other distributions, you can either search in your distribution’s repositories or download the .tar.gz package from here.

After downloading the package, run the following commands (assuming it’s in the Downloads directory):

cd Downloads/

tar -xzvf rtorrent*.tar.gz

cd rtorrent<Tab>

(Press the tab key after writing rtorrent. Terminal will complete rest of the name.)

./configure; make; sudo make install

And that’s it. For more information on installation, visit this site.

Usage

rTorrent is a great program, especially if you know the keyboard commands and shortcuts. So, we’ll be showing some of the everyday actions that you’ll require to manage your torrents.

Starting up rTorrent

Starting it up is easy. Just fire up a terminal, and write:

rtorrent

rTorrent will cover up the whole terminal screen.

rT openingrT opening 
 

Adding torrents

There are two options to add torrents. First, you can use a downloaded torrent file or the URL of the torrent file. Both have the same method.

After starting rTorrent, press Enter, and you’ll get this:

rT enter(ed)rT enter(ed) 
 

Now after this ‘load.normal>’ part, enter the location, or the URL of the file. By default, the working directory of this program is the home directory. So say if you want to select a torrent from the Downloads directory, enter Downloads, and DON’T press Enter. You have to enter the whole filename of the torrent file, so press the Tab key. That will list all the files in the window.

rT-tabrT-tab 
 

Complete the filename, and press Enter. The torrent will appear in the window.

Alternatively, press Enter after starting rTorrent and copy-paste the URL of the torrent file.

rT location of torrentrT location of torrent rT URLrT URL 
 

The torrent will not start downloading by default. It would begin automatically if you press Backspace instead of entering to input the location of the torrent file. We intentionally did this, because if you enter it that way, you don’t get the option to change the destination directory of the torrent download. So that’s the next part.

Magnet links

Adding magnet via RPC #752

rtxmlrpc load.start '' 'magnet:?xt=urn:btih:874fc6a6a52372f73b6b0723344ec8124f377a00&dn=archlinux-2018.06.01-x86_64.iso&tr=udp://tracker.archlinux.org:6969&tr=http://tracker.archlinux.org:6969/announce'

Changing the destination directory

Now that the torrent is added press the upper arrow key to select it. When it is selected, three asterisks (*) will appear to the torrent’s left.

rT selected torrentrT selected torrent 
 

Now enter CTRL + O. This will show a prompt of change_directory, and now you can enter the desired destination directory.

Don’t worry; you won’t have to do this every time. We will show the automation of this at the end of the article.

Starting download

Now to start the download of the torrent, simply select it (using upper arrow) and press CTRL + S. The download will begin.

Stopping and removing the torrent download

Stopping and removing the use of the same command. To stop/pause a download, select it and press CTRL + D. After stopping it once, the status will show Inactive. To remove it, press the same combination one more time.

Viewing more information

To see more information, you simply have to select the torrent and press the Right Arrow key. I have described before in this article what information will show up.

Changing priorities

Changing priorities is simple. All you have to do is select the torrent, and press ‘+’ if you want to set it to a high priority level, and ‘-‘, if you want to set it to a low priority level. (NOTE: The ‘+’ and ‘-‘ of the number-pad don’t work. Use the ones on the left of backspace~). The priority will show up on the right side.

rT-priorityrT-priority 
 

You can also change the priorities of files of a specific torrent, after going in the ‘File list’ sub-section of the information menu (the one that comes up after pressing Right Arrow key).

Viewing options

There exists an option to view files by their status. Some are listed:

Exiting

To exit rTorrent, press CTRL + Q.

Configuration file

It is optional but highly recommended. rTorrent does have certain disadvantages, but you can work around them. We will create a configuration file for rTorrent that will have all the needed details.

First, create the file using:

nano rtorrent.rc

We will first change the default destination from home directory to wherever we want. We will use a directory named rtorrent for example (make sure to create a directory of that name). Enter this:

 directory=~/rtorrent/

(‘~’ symbol signifies home directory.)

Next, to auto-resume incomplete downloads on starting rTorrent, you will have to add the location of the directory in which the torrent files are located. Typically, it’s the Downloads directory.

load_start=~/Downloads/*.torrent

So the file looks like this:

rT confrT conf 
 

Now save it by pressing CTRL + X, and then type ‘y’ and press Enter.

Conclusion

We have explained everything in detail so that you can change and use the options available as much as you’d like. For even more commands and options, visit this site. rTorrent is an excellent program for the highest productivity, and we hope you have fun using it!

Let us know about your views in the comment section.